package com.rd.server.modules.user.controller;

import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import com.rd.common.model.Result;
import com.rd.modules.user.model.vo.UserVO;
import com.rd.server.modules.user.service.UserService;
import com.rd.server.modules.user.model.po.UserPO;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户模块
 * @ClassName UserController
 * @Description 用户模块
 * @Author zyy
 * @Date 2025/2/12 20:39
 * @Version 1.0
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;


    /**
     * 用户详情
     * @return
     */
    @GetMapping("info")
    public Result<UserVO> info() {
        String userId = StpUtil.getLoginIdAsString();
        UserPO userPO = userService.selectByUserId(userId);
        UserVO userVO = BeanUtil.copyProperties(userPO, UserVO.class);
        return Result.success(userVO);
    }


}
